//@import '../theme/variables.scss';
@import "./variables.scss";
@import "./mixin.scss";
$module: #{$prefix}-tag;

$colors: "amber", "blue", "cyan", "green", "grey", "indigo", "light-blue", "light-green", "lime", "orange", "pink",
    "purple", "red", "teal", "violet", "yellow";

$types: "ghost", "solid", "light";

.#{$module} {
    box-sizing: border-box;
    border-radius: $radius-tag;
    background-color: transparent;
    position: relative;
    user-select: none;
    // hidden avatar tag image
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
    @include all-center;
    display: inline-flex;

    &-default,
    &-small {
        @include font-size-small;
        height: $height-tag_small;
        padding: $spacing-tag_small-paddingY $spacing-tag_small-paddingX;
        &:focus-visible {
            outline: $width-tag-outline solid $color-tag-outline-focus;
        }
    }

    &-square {
        border-radius: $radius-tag;
    }
    &-circle {
        border-radius: $radius-tag_circle;
    }

    &-large {
        @include font-size-small;
        padding: $spacing-tag_large-paddingY $spacing-tag_large-paddingX;
        height: $height-tag_large;
        &:focus-visible {
            outline: $width-tag-outline solid $color-tag-outline-focus;
        }
    }

    &-invisible {
        display: none;
    }

    &-prefix-icon {
        display: flex;
        padding-right: $spacing-tag_prefix_icon_paddingRight;
    }

    &-suffix-icon {
        display: flex;
        padding-left: $spacing-tag_suffix_icon_paddingLeft;
    }

    &-content {
        flex: 1;

        &-ellipsis {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        &-center {
            display: flex;
            @include all-center;
            height: 100%;
            min-width: 0;
        }
    }

    &-close {
        @include all-center;
        color: $color-tag_close-icon-default;
        padding-left: $spacing-tag_close-paddingLeft;
        cursor: pointer;

        &:hover {
            color: $color-tag_close-icon-hover;
        }

        &:active {
            color: $color-tag_close-icon-active;
        }
    }

    &-closable {
        padding: $spacing-tag_closable-paddingTop $spacing-tag_closable-paddingRight $spacing-tag_closable-paddingBottom
            $spacing-tag_closable-paddingLeft;
    }

    &-avatar-square,
    &-avatar-circle {
        .#{$prefix}-avatar {
            margin-right: $spacing-tag_avatar-marginRight;
        }
    }

    &-avatar-square {
        padding: $spacing-tag_avatar_square-paddingTop $spacing-tag_avatar_square-paddingRight
            $spacing-tag_avatar_square-paddingBottom $spacing-tag_avatar_square-paddingLeft;

        .#{$prefix}-avatar {
            & > img {
                background-color: $color-tag_avatar_square_img-bg-default;
            }
        }
    }

    &-avatar-circle {
        padding: $spacing-tag_avatar_circle-paddingTop $spacing-tag_avatar_circle-paddingRight
            $spacing-tag_avatar_circle-paddingBottom $spacing-tag_avatar_circle-paddingLeft;
    }

    &-avatar-square.#{$module}-default,
    &-avatar-square.#{$module}-small {
        .#{$prefix}-avatar {
            width: $height-tag_small;
            height: $height-tag_small;
        }
    }

    &-avatar-square.#{$module}-large {
        .#{$prefix}-avatar {
            width: $height-tag_large;
            height: $height-tag_large;
        }
    }

    &-avatar-circle.#{$module}-small,
    &-avatar-circle.#{$module}-default {
        // when avatarShape=circle change tag border radius
        border-radius: $height-tag_small * 0.5 + 1px;

        .#{$prefix}-avatar {
            width: $width-tag_avatar_circle_small;
            height: $width-tag_avatar_circle_small;
        }
    }

    &-avatar-circle.#{$module}-large {
        border-radius: $height-tag_large * 0.5 + 1px;

        .#{$prefix}-avatar {
            width: $width-tag_avatar_circle_large;
            height: $width-tag_avatar_circle_large;
        }
    }

    &-colorful {
        font-weight: $font-tag_colorful-fontWeight;

        &.#{$module}-solid {
            background: $color-tag_colorful_solid-bg;
            color: $color-tag_colorful_solid-text;

            &.#{$module}-gradient { 
                background: $color-tag_colorful_solid_gradient-bg;
            }
        }

        &.#{$module}-light {
            background: $color-tag_colorful_light-bg;
            color: $color-tag_colorful_light-text;

            &.#{$module}-gradient { 
                background: $color-tag_colorful_light_gradient-bg;

                .#{$module}-prefix-icon {
                    svg {
                        stop:nth-child(1) {
                            stop-color: $color-tag_colorful_light_gradient-1;
                        }

                        stop:nth-child(2) {
                            stop-color: $color-tag_colorful_light_gradient-2;
                        }

                        stop:nth-child(3) {
                            stop-color: $color-tag_colorful_light_gradient-3;
                        }

                        stop:nth-child(4) {
                            stop-color: $color-tag_colorful_light_gradient-4;
                        }
                    }
                }

                .#{$module}-content {
                    background: $color-tag_colorful_light_gradient-text;
                    background-clip: text;
                    color: transparent;
                }
            }
        }

        &.#{$module}-ghost {
            background: $color-tag_colorful_ghost-bg;
            color: $color-tag_colorful_ghost-text;
            border-color: $color-tag_colorful_ghost-border;
            
           &.#{$module}-gradient { 
                border: none;

                .#{$module}-prefix-icon {
                    svg {
                        stop:nth-child(1) {
                            stop-color: $color-tag_colorful_ghost_gradient-1;
                        }

                        stop:nth-child(2) {
                            stop-color: $color-tag_colorful_ghost_gradient-2;
                        }

                        stop:nth-child(3) {
                            stop-color: $color-tag_colorful_ghost_gradient-3;
                        }

                        stop:nth-child(4) {
                            stop-color: $color-tag_colorful_ghost_gradient-4;
                        }
                    }
                }

                &.#{$module}-circle {
                    &::before {
                        border-radius: $radius-tag_circle;
                    }
                }

                &::before {
                    content: "";
                    position: absolute;
                    inset: 0;
                    border-radius: $radius-tag;
                    padding: $width-tag-border;
                    background: $color-tag_colorful_ghost-border;
                    -webkit-mask: linear-gradient($color-tag_colorful_ghost-bg 0 0) content-box, linear-gradient($color-tag_colorful_ghost-bg 0 0);
                    mask: linear-gradient($color-tag_colorful_ghost-bg 0 0) content-box, linear-gradient($color-tag_colorful_ghost-bg 0 0);
                    -webkit-mask-composite: xor;
                    mask-composite: exclude;
                    pointer-events: none;
                }

                .#{$module}-content {
                    background: $color-tag_colorful_ghost_gradient-text;
                    background-clip: text;
                    color: transparent;
                }
            }
        }
        
    }
}

.#{$module}-group {
    display: block;
    height: auto;

    .#{$module} {
        margin-bottom: $spacing-tag_group-marginBottom;
        margin-right: $spacing-tag_group-marginRight;
    }

    &-max.#{$module}-group-small {
        height: ($height-tag_small + 2px);
    }
    &-max.#{$module}-group-large {
        height: ($height-tag_large + 2px);
    }
    // &-small {
    //     height: ($height-tag_small + 2);
    // }
    // &-large {
    //     height: ($height-tag_large + 2);
    // }
}

.#{$module}-rest-group-popover {
    .#{$module} {
        margin-right: $spacing-tag_group-marginRight;
        margin-bottom: $spacing-tag_group-marginBottom;
        &:last-of-type {
            margin-right: 0;
        }
    }
}

@each $c in $colors {
    @each $t in $types {
        .#{$module}-#{$c}-#{$t} {
            @include tag-style($c, $t);
        }
    }
}

@each $t in $types {
    .#{$module}-white-#{$t} {
        background-color: $color-tag_white-bg-default;
        border: $width-tag-border solid $color-tag_white-border-default;
        color: $color-tag_white-text-default;
        // .#{$module}-close {
        //     color: $tag-color-white-default-icon;
        // }
    }
}

.#{$module}-white-ghost,
.#{$module}-white-light,
.#{$module}-white-solid {
    .#{$module}-close {
        color: $color-tag_white-icon-default;
    }
}

.#{$module}-avatar-square,
.#{$module}-avatar-circle {
    background-color: $color-tag_avatar-bg-default;
    border: $width-tag_avatar-border solid $color-tag_avatar-border-default;
    color: $color-tag_avatar-text-default;
}

@import './rtl.scss';
